package itsm.isperp.workflow.engine.identity.persistence;

import itsm.isperp.framework.service.IRoleService;
import itsm.isperp.framework.service.IUserService;

import java.util.List;

import org.activiti.engine.identity.Group;
import org.activiti.engine.identity.GroupQuery;
import org.activiti.engine.impl.GroupQueryImpl;
import org.activiti.engine.impl.Page;
import org.activiti.engine.impl.persistence.entity.GroupEntityManager;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 重写工作流的用户组管理
 * 
 * @author lizx
 * @date 2013-3-7
 */
@Service
public class ActivitiGroupManager extends GroupEntityManager {

	@Autowired
	protected IRoleService roleService;

	@Autowired
	protected IUserService userService;

	@Override
	public List<Group> findGroupsByUser(String userId) {
		return userService.findMemberRoleEntityByUsername(userId);
	}

	@Override
	public Group createNewGroup(String groupId) {
		throw new UnsupportedOperationException();
	}

	@Override
	public void insertGroup(Group group) {
		throw new UnsupportedOperationException();
	}

	@Override
	public void deleteGroup(String groupId) {
		throw new UnsupportedOperationException();
	}

	@Override
	public GroupQuery createNewGroupQuery() {
		return super.createNewGroupQuery();
	}

	@Override
	public List<Group> findGroupByQueryCriteria(GroupQueryImpl query, Page page) {
		throw new UnsupportedOperationException();
	}

	@Override
	public long findGroupCountByQueryCriteria(GroupQueryImpl query) {
		throw new UnsupportedOperationException();
	}

}
